package com.own.component.netty.controller;

import com.own.component.netty.constant.ConstantCommon;
import com.own.component.netty.handler.ChannelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * InfoController
 *
 * @author chenxueli
 * @date 2021/4/14 15:45
 */
@RestController
@RequestMapping(ConstantCommon.WEBSOCKET + "/info")
public class NettyInfoController {

    @GetMapping("/")
    public Map<String, Object> get() {
        var map = new HashMap<String, Object>(4);
        map.put("count", ChannelMap.getOnlineCount());
        return map;
    }

}
